import axios from 'axios'

export let getList =()=>{
    return (dispatch)=>{
        axios.get('/list').then(res =>{
            console.log(res.data)
            dispatch({
                type:"GET_LIST",
                payload:res.data
            })
        })
    }
}


export let ChangeIndex =(indxs)=>{
    return (dispatch)=>{
       dispatch({
            type:"C_INDEX",
            payload:indxs
        })
     }
}

export let Shai =(values)=>{
    return (dispatch)=>{
       dispatch({
            type:"PAI",
            payload:values
        })
     }
}
//收藏
export let Like=(item) =>{
    return (dispatch)=>{
        dispatch({
            type:"SHOU",
            payload:item
        })
    }
}

//加入购物车
export let addShop=(id)=>{
    return (dispatch)=>{
        dispatch({
            type:"ADD_SHOP",
            payload:id
        })
    }
}

//购物车数量增加

//单选
export let checked=(item)=>{
    return (dispatch) =>{
        dispatch({
            type:"CHECKED",
            payload:item
        })
    }
}
//全选
export let allChecked=(checked)=>{
    return (dispatch)=>{
        dispatch({
            type:'ALL_CHECKED',
            payload:checked
        })
    }
}